package net.qiqb.spring;

import net.qiqb.spring.execution.CommandTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
public class QiqbConfiguration {

    @Bean
    public QiqbContextRefreshedEventListener qiqbContextRefreshedEventListener() {
        return new QiqbContextRefreshedEventListener();
    }

    /**
     * 聚合根持久管理
     *
     * @return
     */
    @Bean
    public AggregatePersistenceManager aggregatePersistenceManager() {
        return new AggregatePersistenceManager();
    }


    //@Bean
    public DomainObjectLoaderProcessor domainObjectLoaderProcessor() {
        return new DomainObjectLoaderProcessor();
    }

    @Bean
    public CommandTemplate commandTemplate(SpringExecutionContext executionContext) {
        return new CommandTemplate(executionContext.getQiqbBuilder());
    }


}
